angular.module('app.posts', ['ui.router', 'oc.lazyLoad'])
    .config([
        '$ocLazyLoadProvider',
        '$stateProvider',

        function ($ocLazyLoadProvider, $stateProvider) {

            $stateProvider
                .state('app.posts.post', {
                    url: '/:id',
                    views: {
                        post: {
                            templateUrl: 'post.html',
                            controller: 'PostController',
                            resolve: {
                                post: ['$ocLazyLoad', function ($ocLazyLoad) {
                                    return $ocLazyLoad.load({
                                        serie: true,
                                        files: [
                                            'post.js',
                                            'post-controller.js'
                                        ]
                                    });
                                }]
                            }
                        }
                    }
                });
        }
    ]);
